package redis

import (
	"context"
	"fmt"
	"onerk4/zk1/global"
	"time"
)

func SetSms(mobile, source, code string) {
	key := fmt.Sprintf("sms:%s:%s", source, mobile)
	global.Rdb.Set(context.Background(), key, code, time.Minute*5)
}

func GetSms(mobile, source string) string {
	key := fmt.Sprintf("sms:%s:%s", source, mobile)
	return global.Rdb.Get(context.Background(), key).Val()
}

func DelSms(mobile, source string) {
	key := fmt.Sprintf("sms:%s:%s", source, mobile)
	global.Rdb.Del(context.Background(), key)
}
